#include <cstdio>


/**
 * 无向图的邻接矩阵
 * 
 * */
 
int main() {
    // 点的最大数量
    const int MAX_NODES = 11;

    int graph[MAX_NODES][MAX_NODES]{};

    int nodes = 5;

    int edges[5][2] = {
        // 1-2
        {1, 2},
        // 2-3
        {2, 3},
        // 3-5
        {3, 5},
        // 4-5
        {4, 5},
        // 5-1
        {5, 1}
    };

    for (int i = 0; i < 5; i++) {
        graph[edges[i][0]][edges[i][1]] = 1;
        graph[edges[i][1]][edges[i][0]] = 1;
    }

    printf("无向图的邻接矩阵遍历:\n");

    for (int i = 0; i <= nodes; i++) {
        for (int j = 0; j <= nodes; j++) {
            printf("%d ", graph[i][j]);
        }
        printf("\n");
    }

    return 0;
}